package com.zhsm.fuxi.mvp.ui.adapter

import android.support.v4.view.PagerAdapter
import android.view.View
import android.view.ViewGroup

/**
 * Created by GuZhC on 2018/11/8.
 * describe:
 */
class TakePicVpAdapter constructor(mImages:List<View>): PagerAdapter() {

    val images = mImages
    override fun isViewFromObject(view: View, obj: Any): Boolean {
        return view == obj
    }

    override fun getCount(): Int {
       return images.size
    }

    override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) {
        container.removeView(images[position])
    }

    override fun instantiateItem(container: ViewGroup, position: Int): Any {
        container.addView(images[position])
        return images[position]
    }

    override fun getItemPosition(`object`: Any): Int {
        return POSITION_UNCHANGED
    }
}